package com.holly.unit.bpmn.activiti.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.activiti.engine.task.Task;

import java.util.Date;

/**
 * 类描述: 流程任务
 *
 * @author fxr
 * @version 1.0.0
 * @date 2022/3/8 14:23
 */
@Data
public class ProcessTaskResponse {
    private String id;

    /**任务名称*/
    private String name;

    private String key;

    private String description;

    private String executionId;

    /**代理人（受让人）*/
    private String assignee;

    /**所属人（委托人）*/
    private String owner;

    /**流程定义Id */
    private String procDefId;

    /**流程实列Id */
    private String procInstId;

    /**发起人*/
    private String applyer;

    private String category;

    /**优先级[0-普通 1-重要 2-紧急]*/
    private Integer priority;

    /**状态[0-已激活 1-已挂起]*/
    private Boolean isSuspended;

    /**创建时间*/
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**所属流程*/
    private String processName;

    /**关联前端表单路由名*/
    private String routeName;

    /**业务key*/
    private String businessKey;

    /**数据表Id*/
    private String tableId;

    /**数据表名*/
    private String tableName;
    private Integer type;

    public ProcessTaskResponse(Task task){
        this.id = task.getId();
        this.name = task.getName();
        this.key = task.getTaskDefinitionKey();
        this.description = task.getDescription();
        this.executionId = task.getExecutionId();
        this.assignee = task.getAssignee();
        this.owner = task.getOwner();
        this.procDefId = task.getProcessDefinitionId();
        this.procInstId = task.getProcessInstanceId();
        this.priority = task.getPriority();
        this.isSuspended = task.isSuspended();
        this.category = task.getCategory();
        this.createTime = task.getCreateTime();
    }
}
